<?php

class PageMenu extends Page
{
	public function getHTML()
	{
		$html = $this->getHeaderHTML();

		$submitScript = new SubmitFormScript();
		$html .= $submitScript->getHTML();

		$script = new EditDeleteFormScript();
		$html .= $script->getHTML();

		$html .= $this->getBodyTopHTML();
		$html .= $this->getHiddenVariables();

		$aDropDownList = new DropDownList();

		$sql = "SELECT Persons.PersonID, Persons.FirstName, Persons.Surname, Animateurs.PersonID FROM Persons, Animateurs WHERE Animateurs.PersonID = Persons.PersonID";
		$this->Database->ExecuteSQL($sql);
		while($row=$this->Database->getRow())
		{
			$aDropDownList->addOption(new DropDownListOption($row['FirstName']." ".$row['Surname'],$row['PersonID']));
		}

		$aDropDownList->setName("DDL1");
		$aDropDownList->setValue("Value");
		$html .= $aDropDownList->getHTML();
		$html .= "<br>\n";

		$yetanotherdropdownlist  = new DropDownListEnumeration($this->Database,"EventTypes");
		$yetanotherdropdownlist->setName("EventTypes");
		$html .= $yetanotherdropdownlist->getHTML();

		$anotherdropdownlist  = new DropDownListEnumeration($this->Database,"EventInvolvees");
		$anotherdropdownlist->setName("EventInvolvees");
		$html .= $anotherdropdownlist->getHTML();

/*
		if(isset($_POST['Action']))
			$html .= "Action = ".$_POST['Action']."<br>\n";
		if(isset($_POST['RecordID']))
			$html .= "RecordID = ".$_POST['RecordID']."<br>\n";

		$aTextbox = new Textbox();
		$html .= $aTextbox->getHTML(); 
		$html .= "<br>\n";


		$aRadiobutton1 = new Radiobutton();
		$aRadiobutton1->setName("RB1");
		$aRadiobutton1->setValue("Hello 1");
		$aRadiobutton1->setText("Text 1");
		$aRadiobutton2 = new Radiobutton();
		$aRadiobutton2->setName("RB1");
		$aRadiobutton2->setValue("Hello 2");
		$aRadiobutton2->setText("Text 2");
		$aRadiobutton2->setChecked(true);
		$html .= $aRadiobutton1->getHTML().$aRadiobutton2->getHTML();
		$html .= "<br>\n";

		$aCheckbox = new Checkbox();
		$aCheckbox->setCSSClass("dismal");
		$aCheckbox->setName("CB1");
		$aCheckbox->setValue("Hello 1");
		$aCheckbox->setText("Text 1");
		$aCheckbox->setChecked(true);
		$html .= $aCheckbox->getHTML();
		$html .= "<br>\n";

		$aDate = new DateSelect();
		$aDate->setName("DS");
		$aDate->setValue("Hello 2");
		$aDate->setText("Text 2");
		$html .= $aDate->getHTML();
		$html .= "<br>\n";

		$aTime = new TimeSelect();
		$aTime->setName("DTS");
		$aTime->setValue("Hello 3");
		$aTime->setText("Text 3");
		$html .= $aTime->getHTML();
		$html .= "<br>\n";

		$aDateTime = new DateTimeSelect();
		$aDateTime->setName("DTS");
		$aDateTime->setValue("Hello 1");
		$aDateTime->setText("Text 1");
		$html .= $aDateTime->getHTML();
		$html .= "<br>\n";

		$submitbutton1 = new SubmitButton();
		$submitbutton1->setName("But1");
		$submitbutton1->setValue("Button 1");
		$html .= $submitbutton1->getHTML();
		$html .= "<br>\n";

		$submitbutton2 = new SubmitButton();
		$submitbutton2->setName("But2");
		$submitbutton2->setValue("Button 2");
		$submitbutton2->setOnClick("alert ('hello');");
		$html .= $submitbutton2->getHTML();
		$html .= "<br>\n";

		$datatable = new DataTable();
		$datatable->setName("Table");
		$datatable->setValue("Table");
		$datatable->setEditable(true);
		$datatable->setDeletable(true);
		$datatable->setDBTableName("Persons");
		$datatable->setPrimaryField("PersonID");
		$datatable->setDatabase($this->Database);
		$datatable->setColumns(array("FirstName" => "Christian Name", "Surname" => "Last Name", "Email" => "Email Address"));
		$datatable->setSQL("select P.PersonID as ColumnID, P.FirstName, P.Surname, P.Email from Persons as P, Animateurs as A WHERE P.PersonID = A.PersonID");
		$html .= $datatable->getHTML();
		$html .= "<br>\n";
*/
		$datatable = new DataTable();
		$datatable->setName("Events");
		$datatable->setValue("Events");
		$datatable->setEditable(true);
		$datatable->setDeletable(true);
		if(isset($_POST['ShowDeleted']))
			$datatable->showDeleted(true);
		$datatable->setDBTableName("Events");
		$datatable->setDatabase($this->Database);
		$columns = array();
		$columns[] = new DataTableColumn("Start","Date","DateOnly");
		$columns[] = new DataTableColumn("Start","Start","TimeOnly");
		$columns[] = new DataTableColumn("End","End","TimeOnly");
		$columns[] = new DataTableColumn("Title","Title","");
		$columns[] = new DataTableColumn("Description","Description","");
		$columns[] = new DataTableColumn("EventTypeID","Event Type","SingleEnumeration");
		$datatable->setColumns($columns);
		$datatable->setSQL("select EventID as ColumnID, Start, End, Title, Description, EventTypeID, DeletedBy FROM Events");
		$html .= $datatable->getHTML();
		$html .= "<br>\n";

		$html .= $this->getBodyBottomHTML();
		return $html;
	}
}
?>